package com.zywl.utils.models;

/**
 * layui返回封装对象
 *
 * @author xushixiang
 */
public class JsonResult {
    private int code;
    private String msg;
    private Object data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }



    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
    public JsonResult success(String message, Object data, int total){
        setCode(0);
        setMsg(message);
        setData(data);
        return this;
    }

    public JsonResult success(String message, Object data){
        setCode(0);
        setMsg(message);
        setData(data);
        return this;
    }
    public JsonResult success(String message){
        setCode(0);
        setMsg(message);
        return this;
    }
    public JsonResult error(String message, Object data){
        setCode(1);
        setMsg(message);
        setData(data);
        return this;
    }

    public JsonResult error(String message){
        setCode(1);
        setMsg(message);
        return this;
    }
}
